﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using yiwei.Repository.Entity;

namespace yiwei.Repository.EntityConfig
{
    public class UserMap : IEntityTypeConfiguration<User>
    {
        public void Configure(EntityTypeBuilder<User> builder)
        {
    
           builder.ToTable("User");
           builder.HasKey(c => c.Id);
           builder.Property(b => b.Account).HasColumnType("varchar(100)").IsRequired();
           builder.HasIndex(b => b.Account).IsUnique().HasName("Index_Account"); //唯一索引·
           builder.Property(b => b.Password).HasColumnType("varchar(100)").IsRequired();
           builder.Property(b => b.Name).HasColumnType("varchar(100)").IsRequired();
           builder.Property(b => b.Remark).HasColumnType("varchar(200)").IsRequired();

        }
    }
}
